package com.qk.web.config;

import com.qk.web.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: zhangchuang
 * @Date: 2025/10/11 14:19
 * @Description: web配置类
 */
@Configuration
@SuppressWarnings("all")
public class WebConfig implements WebMvcConfigurer {

    private static final String LOGIN_URI = "/login";
    private static final String ALL_URI = "/**";

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns(ALL_URI)
                .excludePathPatterns(LOGIN_URI);
    }
}
